Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Delete detector successfully if workflow is missing #790

Merged

Conversation

engechas
Copy link
Collaborator

@engechas engechas commented Dec 21, 2023

Description

When workflow usage is enabled, deleting a detector after the workflow has been deleted will fail with a "Workflow not found" exception. This PR adds logic to check for a 404 on workflow deletion and proceed with detector deletion if so.

Issues Resolved

Partially #618

Related PR: opensearch-project/alerting#1346

Check List

  • New functionality includes testing.
    • All tests pass
  • [N/A] New functionality has been documented.
    • [N/A] New functionality has javadoc added
  • Commits are signed per the DCO using --signoff

By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.
For more information on following Developer Certificate of Origin and signing off your commits, please check here.

Signed-off-by: Chase Engelbrecht <engechas@amazon.com>
Copy link

codecov bot commented Dec 21, 2023

Codecov Report

Attention: 13 lines in your changes are missing coverage. Please review.

Comparison is base (01facfc) 24.66% compared to head (3c91488) 24.73%.
Report is 3 commits behind head on main.

Files Patch % Lines
...ytics/transport/TransportDeleteDetectorAction.java 0.00% 13 Missing ⚠️
Additional details and impacted files
@@             Coverage Diff              @@
##               main     #790      +/-   ##
============================================
+ Coverage     24.66%   24.73%   +0.07%     
- Complexity     1022     1023       +1     
============================================
  Files           275      275              
  Lines         12711    12695      -16     
  Branches       1399     1400       +1     
============================================
+ Hits           3135     3140       +5     
+ Misses         9311     9290      -21     
  Partials        265      265              

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

Signed-off-by: Chase Engelbrecht <engechas@amazon.com>
@eirsep eirsep merged commit 0ad91cc into opensearch-project:main Jan 3, 2024
13 of 16 checks passed
@opensearch-trigger-bot
Copy link
Contributor

The backport to 2.9 failed:

The process '/usr/bin/git' failed with exit code 1

To backport manually, run these commands in your terminal:

# Fetch latest updates from GitHub
git fetch
# Create a new working tree
git worktree add .worktrees/backport-2.9 2.9
# Navigate to the new working tree
cd .worktrees/backport-2.9
# Create a new branch
git switch --create backport/backport-790-to-2.9
# Cherry-pick the merged commit of this pull request and resolve the conflicts
git cherry-pick -x --mainline 1 0ad91ccecd846439bb3136390e2defbf59eb9e10
# Push it to GitHub
git push --set-upstream origin backport/backport-790-to-2.9
# Go back to the original working tree
cd ../..
# Delete the working tree
git worktree remove .worktrees/backport-2.9

Then, create a pull request where the base branch is 2.9 and the compare/head branch is backport/backport-790-to-2.9.

@opensearch-trigger-bot
Copy link
Contributor

The backport to 2.10 failed:

The process '/usr/bin/git' failed with exit code 1

To backport manually, run these commands in your terminal:

# Fetch latest updates from GitHub
git fetch
# Create a new working tree
git worktree add .worktrees/backport-2.10 2.10
# Navigate to the new working tree
cd .worktrees/backport-2.10
# Create a new branch
git switch --create backport/backport-790-to-2.10
# Cherry-pick the merged commit of this pull request and resolve the conflicts
git cherry-pick -x --mainline 1 0ad91ccecd846439bb3136390e2defbf59eb9e10
# Push it to GitHub
git push --set-upstream origin backport/backport-790-to-2.10
# Go back to the original working tree
cd ../..
# Delete the working tree
git worktree remove .worktrees/backport-2.10

Then, create a pull request where the base branch is 2.10 and the compare/head branch is backport/backport-790-to-2.10.

@opensearch-trigger-bot
Copy link
Contributor

The backport to 2.11-with-features failed:

The process '/usr/bin/git' failed with exit code 1

To backport manually, run these commands in your terminal:

# Fetch latest updates from GitHub
git fetch
# Create a new working tree
git worktree add .worktrees/backport-2.11-with-features 2.11-with-features
# Navigate to the new working tree
cd .worktrees/backport-2.11-with-features
# Create a new branch
git switch --create backport/backport-790-to-2.11-with-features
# Cherry-pick the merged commit of this pull request and resolve the conflicts
git cherry-pick -x --mainline 1 0ad91ccecd846439bb3136390e2defbf59eb9e10
# Push it to GitHub
git push --set-upstream origin backport/backport-790-to-2.11-with-features
# Go back to the original working tree
cd ../..
# Delete the working tree
git worktree remove .worktrees/backport-2.11-with-features

Then, create a pull request where the base branch is 2.11-with-features and the compare/head branch is backport/backport-790-to-2.11-with-features.

@opensearch-trigger-bot
Copy link
Contributor

The backport to 2.9-with-features failed:

The process '/usr/bin/git' failed with exit code 1

To backport manually, run these commands in your terminal:

# Fetch latest updates from GitHub
git fetch
# Create a new working tree
git worktree add .worktrees/backport-2.9-with-features 2.9-with-features
# Navigate to the new working tree
cd .worktrees/backport-2.9-with-features
# Create a new branch
git switch --create backport/backport-790-to-2.9-with-features
# Cherry-pick the merged commit of this pull request and resolve the conflicts
git cherry-pick -x --mainline 1 0ad91ccecd846439bb3136390e2defbf59eb9e10
# Push it to GitHub
git push --set-upstream origin backport/backport-790-to-2.9-with-features
# Go back to the original working tree
cd ../..
# Delete the working tree
git worktree remove .worktrees/backport-2.9-with-features

Then, create a pull request where the base branch is 2.9-with-features and the compare/head branch is backport/backport-790-to-2.9-with-features.

@opensearch-trigger-bot
Copy link
Contributor

The backport to 2.11 failed:

The process '/usr/bin/git' failed with exit code 1

To backport manually, run these commands in your terminal:

# Fetch latest updates from GitHub
git fetch
# Create a new working tree
git worktree add .worktrees/backport-2.11 2.11
# Navigate to the new working tree
cd .worktrees/backport-2.11
# Create a new branch
git switch --create backport/backport-790-to-2.11
# Cherry-pick the merged commit of this pull request and resolve the conflicts
git cherry-pick -x --mainline 1 0ad91ccecd846439bb3136390e2defbf59eb9e10
# Push it to GitHub
git push --set-upstream origin backport/backport-790-to-2.11
# Go back to the original working tree
cd ../..
# Delete the working tree
git worktree remove .worktrees/backport-2.11

Then, create a pull request where the base branch is 2.11 and the compare/head branch is backport/backport-790-to-2.11.

@opensearch-trigger-bot
Copy link
Contributor

The backport to 2.x failed:

The process '/usr/bin/git' failed with exit code 1

To backport manually, run these commands in your terminal:

# Fetch latest updates from GitHub
git fetch
# Create a new working tree
git worktree add .worktrees/backport-2.x 2.x
# Navigate to the new working tree
cd .worktrees/backport-2.x
# Create a new branch
git switch --create backport/backport-790-to-2.x
# Cherry-pick the merged commit of this pull request and resolve the conflicts
git cherry-pick -x --mainline 1 0ad91ccecd846439bb3136390e2defbf59eb9e10
# Push it to GitHub
git push --set-upstream origin backport/backport-790-to-2.x
# Go back to the original working tree
cd ../..
# Delete the working tree
git worktree remove .worktrees/backport-2.x

Then, create a pull request where the base branch is 2.x and the compare/head branch is backport/backport-790-to-2.x.

jowg-amazon pushed a commit to jowg-amazon/security-analytics that referenced this pull request Jan 10, 2024
…ct#790)

* Delete detector successfully if workflow is missing

Signed-off-by: Chase Engelbrecht <engechas@amazon.com>

* Refactor to use existing NotFound exception checker

Signed-off-by: Chase Engelbrecht <engechas@amazon.com>

---------

Signed-off-by: Chase Engelbrecht <engechas@amazon.com>
@engechas
Copy link
Collaborator Author

Using workflows in detectors was introduced in 2.10 as part of #533, backporting to 2.9 and 2.9-with-features should be unnecessary. Working to resolve the conflicts in the other backport branches

engechas added a commit to engechas/security-analytics that referenced this pull request Jan 16, 2024
…ct#790)

* Delete detector successfully if workflow is missing

Signed-off-by: Chase Engelbrecht <engechas@amazon.com>

* Refactor to use existing NotFound exception checker

Signed-off-by: Chase Engelbrecht <engechas@amazon.com>

---------

Signed-off-by: Chase Engelbrecht <engechas@amazon.com>
(cherry picked from commit 0ad91cc)
engechas added a commit to engechas/security-analytics that referenced this pull request Jan 16, 2024
…ct#790)

* Delete detector successfully if workflow is missing

Signed-off-by: Chase Engelbrecht <engechas@amazon.com>

* Refactor to use existing NotFound exception checker

Signed-off-by: Chase Engelbrecht <engechas@amazon.com>

---------

Signed-off-by: Chase Engelbrecht <engechas@amazon.com>
(cherry picked from commit 0ad91cc)
engechas added a commit to engechas/security-analytics that referenced this pull request Jan 16, 2024
…ct#790)

* Delete detector successfully if workflow is missing

Signed-off-by: Chase Engelbrecht <engechas@amazon.com>

* Refactor to use existing NotFound exception checker

Signed-off-by: Chase Engelbrecht <engechas@amazon.com>

---------

Signed-off-by: Chase Engelbrecht <engechas@amazon.com>
(cherry picked from commit 0ad91cc)
engechas added a commit to engechas/security-analytics that referenced this pull request Jan 16, 2024
…ct#790)

* Delete detector successfully if workflow is missing

Signed-off-by: Chase Engelbrecht <engechas@amazon.com>

* Refactor to use existing NotFound exception checker

Signed-off-by: Chase Engelbrecht <engechas@amazon.com>

---------

Signed-off-by: Chase Engelbrecht <engechas@amazon.com>
(cherry picked from commit 0ad91cc)
engechas added a commit to engechas/security-analytics that referenced this pull request Jan 17, 2024
…ct#790)

* Delete detector successfully if workflow is missing

Signed-off-by: Chase Engelbrecht <engechas@amazon.com>

* Refactor to use existing NotFound exception checker

Signed-off-by: Chase Engelbrecht <engechas@amazon.com>

---------

Signed-off-by: Chase Engelbrecht <engechas@amazon.com>
(cherry picked from commit 0ad91cc)
jowg-amazon pushed a commit that referenced this pull request Feb 5, 2024
* Delete detector successfully if workflow is missing

Signed-off-by: Chase Engelbrecht <engechas@amazon.com>

* Refactor to use existing NotFound exception checker

Signed-off-by: Chase Engelbrecht <engechas@amazon.com>

---------

Signed-off-by: Chase Engelbrecht <engechas@amazon.com>
(cherry picked from commit 0ad91cc)
jowg-amazon pushed a commit that referenced this pull request Feb 5, 2024
* Delete detector successfully if workflow is missing

Signed-off-by: Chase Engelbrecht <engechas@amazon.com>

* Refactor to use existing NotFound exception checker

Signed-off-by: Chase Engelbrecht <engechas@amazon.com>

---------

Signed-off-by: Chase Engelbrecht <engechas@amazon.com>
(cherry picked from commit 0ad91cc)
jowg-amazon pushed a commit that referenced this pull request Feb 5, 2024
* Delete detector successfully if workflow is missing

Signed-off-by: Chase Engelbrecht <engechas@amazon.com>

* Refactor to use existing NotFound exception checker

Signed-off-by: Chase Engelbrecht <engechas@amazon.com>

---------

Signed-off-by: Chase Engelbrecht <engechas@amazon.com>
(cherry picked from commit 0ad91cc)
engechas added a commit that referenced this pull request Mar 11, 2024
* Delete detector successfully if workflow is missing

Signed-off-by: Chase Engelbrecht <engechas@amazon.com>

* Refactor to use existing NotFound exception checker

Signed-off-by: Chase Engelbrecht <engechas@amazon.com>

---------

Signed-off-by: Chase Engelbrecht <engechas@amazon.com>
(cherry picked from commit 0ad91cc)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants